package cn.web.management.web.servlet.inform.user;

import cn.web.management.service.general.MyOfficePage;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "departmentInformServlet", value = "/departmentInformServlet")
public class departmentInformServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    /**
     * @description: 查询员工号所在的部门信息
     * @paramName: [request, response]
     * @paramType: [javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse]
     * @returnType: void
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json;charset=utf-8");
        HttpSession session = request.getSession();
        String employno = (String)session.getAttribute("employno");
        MyOfficePage departmentPage = new MyOfficePage();
        String departmentInform = departmentPage.findDepartmentInform(employno);
        response.getWriter().write(departmentInform);
    }
}
